package com.aoxin.util.enumerate;

import com.aoxin.util.ErrorUtil;

/**
 * 
 * @author Melody
 * @date 2018年4月11日 上午11:04:00
 */
public enum SyllabusState {
	WAIT_ORDER(0, "待启用"),ORDER_ING(1, "预约中"), FULL(2, "已满"), END_ORDER(3, "预约结束"), ATTEND_CLASS_ING(4, "上课中"), NED_ATTEND_CLASS(5, "上课结束");

	private int id;

	private String value;

	private SyllabusState(int id, String value) {
		this.id = id;
		this.value = value;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public static SyllabusState fromId(int id) {
		switch (id) {
		case 1:
			return ORDER_ING;
		case 2:
			return FULL;
		case 3:
			return END_ORDER;
		case 4:
			return ATTEND_CLASS_ING;
		case 5:
			return NED_ATTEND_CLASS;
		}
		throw new RuntimeException(String.format(ErrorUtil.ORDER_COURSE_STATUS, id));
	}
}
